const Koa = require("koa");
const registerRoutes = require("../router");
const bodyparser = require("koa-bodyparser");
const errorHandler = require("./errorHandler");
// 1.创建APP
const app = new Koa();
// 2.应用中间件
app.use(bodyparser());
//3.应用错误处理中间件
app.on("error", errorHandler);
registerRoutes(app);
// 4.导出app
module.exports = app;
